<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //监听最快成功的配米色实例
        //返回值与它一致
        let p1 = new Promise((resolve,reject)=>{
            try {
                console.log('获取A');
                throw new Error('A错误')
                setTimeout(() => {
                    console.log('A结束');
                    resolve('A成功')
                }, 1500);
            }catch (e) {
                reject(e.message);
            }
        })
        let p2 = new Promise((resolve,reject)=>{
            try {
                console.log('获取B');
                
                throw new Error('B错误')
                setTimeout(() => {
                    console.log('B结束');
                    resolve('B成功')
                }, 2500);
            } catch (e) {
                reject(e.message);
            }
        })
        let p3 = new Promise((resolve,reject)=>{
            try {
                console.log('获取C');
                throw new Error('C错误')
                setTimeout(() => {
                    console.log('结束');
                    resolve("C成功")
                }, 2000);
            } catch (e) {
                reject(e.message);
            }
        })

        let result= Promise.any([p1,p2,p3])
        console.log(result);
        result.then(resolve=>{
            console.log('成功');
        }).catch(err=>{
            console.log('失败');
        })
    </script>
</body>
</html>